#include "main/utils.h"
using namespace std;

class Solution {
public:
    int partitionArray(vector<int>& nums, int k) {
      sort(nums.begin(), nums.end());
      int count = 1;
      int first = nums[0];
      for (int i = 1; i < nums.size(); ++i) {
        if (nums[i] - first > k) {
          ++count;
          first = nums[i];
        }
      }
      return count;
    }
};

int main() {
  vector<int> nums = {16, 8, 17, 0, 3, 17, 8, 20};
  int k = 10;
  Solution su;
  cout << su.partitionArray(nums, k) << endl;

  return 0;
}
